﻿using Microsoft.AspNetCore.Mvc;
using ToolMonitoring.WebApi.Demo;
using ToolMonitoring.WebApi.Entities;
using ToolMonitoring.WebApi.Services;

namespace ToolMonitoring.WebApi.Controllers
{

	[ApiController]
	[Route("api/[controller]/[action]")]
	public class UserDemoController: ControllerBase
	{
		private readonly UserDemoService _userDemoService;
		
		public UserDemoController(UserDemoService userDemoService)
		{
			_userDemoService = userDemoService;
		}

		[HttpGet]
		public async Task<UserDemo> FindById(Guid id)
		{
			return await this._userDemoService.FindById(id);
		}

		[HttpPost]
		public async Task<UserDemo> Add(UserDemo data)
		{
			return await this._userDemoService.Add(data);
		}

		[HttpPost,HttpPut]
		public async Task Update(UserDemo data)
		{
			await this._userDemoService.Update(data);
		}

		[HttpDelete]
		public async Task Delete(Guid id)
		{
			await this._userDemoService.Remove(id);
		}

		[HttpGet]
		public async Task<List<UserDemo>> FindAll()
		{
			return await this._userDemoService.FindAll();
		}


	}
}
